Skip to content

feature: Add groups created by addPbxGroup() to the meta PBXGroup #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2018

Conversation

tdermendjiev
Copy link

Current implementation doesn't add created groups to the main/meta PBXGroup and therefore they don't show up in the file tree.

@@ -1,11 +1,12 @@
var util = require('util'),
f = util.format,
EventEmitter = require('events').EventEmitter,
path = require('path'),
$path = require('path'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why we are using $ before path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to differentiate between the global (used for path module) and local (passed in most of the methods) variable.

var groups = this.hash.project.objects['PBXGroup'],
pbxGroupUuid = this.generateUuid(),
pbxGroupUuid = opt.uuid ? opt.uuid : this.generateUuid(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt.uuid || this.generateUuid() is shorter

var groups = this.hash.project.objects['PBXGroup'];
var candidates = [];
for (var key in groups) {
if (groups[key].path == undefined && groups[key].name == undefined && groups[key].isa) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is better

if (groups[key] && !groups[key].path && !groups[key].name && groups[key].isa) { .. }

return candidates[0];
}

return null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case when we have more than one candidate, shouldn't return the first one? Actually is it possible to have more than one candidate?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have exactly one candidate as this will be the root group. If they are more than one there should be an error. Maybe we can throw an exception.

@tdermendjiev tdermendjiev force-pushed the tdermendzhiev/fix-addpbxgroup branch 2 times, most recently from d86b18b to 23214db Compare May 9, 2018 07:45
@mbektchiev mbektchiev force-pushed the tdermendzhiev/fix-addpbxgroup branch 3 times, most recently from a929177 to 733e10a Compare May 17, 2018 11:35
*support for c++ files added
*recursively add pbxGroup and its children
*recursively remove pbxGroup and its children
*make sure pbx group name is not duplicated on adding new group
@tdermendjiev tdermendjiev force-pushed the tdermendzhiev/fix-addpbxgroup branch from cc0ac78 to f1b6a8c Compare May 18, 2018 16:07
lib/pbxFile.js Outdated
@@ -11,13 +15,42 @@ var path = require('path'),
DEFAULT_SOURCE_TREE = '"<group>"',
DEFAULT_FILE_ENCODING = 4;

function fileTypes() {
return {
SOURCE_FILE,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identation issue

return {uuid: pbxGroupUuid, pbxGroup: pbxGroup};
}

pbxProject.prototype.removePbxGroup = function(name, path) {
var group = this.pbxGroupByName(name);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identation problem

Copy link

@Fatme Fatme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After addressing identation problem

@tdermendjiev tdermendjiev force-pushed the tdermendzhiev/fix-addpbxgroup branch from fd2171a to 93cb011 Compare May 22, 2018 07:40
@tdermendjiev tdermendjiev merged commit 0aa91f6 into master May 22, 2018
@mbektchiev mbektchiev deleted the tdermendzhiev/fix-addpbxgroup branch May 22, 2018 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants